package com.qcq.wecheck.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.qcq.wecheck.entity.UserSchedule;

/**
 * <p>
 * 用户-考勤表 中间表 Mapper 接口
 * </p>
 *
 * @author O
 * @since 2018-09-24
 */
public interface UserScheduleMapper extends BaseMapper<UserSchedule> {
	/**
	 * 删除用户参与的签到活动(删除签到内容)
	 * 根据签到表的id和openId
	 *
	 * @param openId     id
	 * @param scheduleId id
	 * @return boolean
	 */
	default boolean quit(Long scheduleId, String openId) {
		EntityWrapper<UserSchedule> wrapper = new EntityWrapper<>();
		wrapper.eq("schedule_id", scheduleId)
				.eq("open_id", openId);
		return this.delete(wrapper) > 0;
	}
}
